<?php

declare(strict_types=1);

namespace So\App\Request\Backend;

use So\App\Model\Backend\Admin;
use So\Validation;
use Hyperf\Validation\Rule;

class AdminRequest extends Validation
{
    public $scene = [

    ];

    public function rules(): array
    {
        return [
            'id'=>'',
            'email'=>'required|email',
            'groups'=>'required|array',
            'password'=>'required_without:id|min:3|max:30',
            'status'=>'required|boolean',
            'username'=>'required|min:3|max:30',
        ];
    }

    public function messages(): array
    {
        return [
            'email.required'=>"请输入邮箱",
            'groups.required'=>"请选择用户组",
            'password.required'=>"请输入密码",
            'status.required'=>"请选择状态",
            'username.required'=>"请输入账号",
            'email.email'=>"邮箱格式错误",
            'groups.array'=>"用户组格式错误",
            'password.min'=>"密码不能小于三位",
            'password.max'=>"密码不能大于三十位",
            'status.boolean'=>"状态格式错误",
            'username.min'=>"账号不能小于三位",
            'username.max'=>"账号不能大于三十位",
        ];
    }
}